// pages/index/eat_plan/eat_plan.js
const app = getApp()
const moment = require('../../utils/moment.js');
Page({
  data: {
    date: "null",
    dateImg: "../../images/sign-date.png",
    eatList: [{
      icon: '../../images/milk.png',
      name: '牛奶',
      sum: '135千卡',
    },
    {
      icon: '../../images/corn.png',
      name: '玉米',
      sum: '140千卡',
    }],
    lunchList:[{
      icon: '../../images/shiguo.png',
      name: '石锅拌饭',
      sum: '231千卡',
    }],
    dinnerList:[{
      icon: '../../images/zhou.png',
      name: '八宝粥',
      sum: '94千卡',
    },
    {
      icon: '../../images/tomato_egg.png',
      name: '番茄炒蛋',
      sum: '111千卡',
    },
    {
      icon: '../../images/chaowosun.png',
      name: '炒莴笋',
      sum: '28千卡',
    }],
    addList:[{
      icon: '../../images/nihoutao.png',
      name: '猕猴桃',
      sum: '42千卡',
    }]
  },
  //获取选定的时间
  bindDateChange: function (e) {
    console.log(e.detail.value)
    this.setData({
      date: e.detail.value
    })
    this.getMealList();
  },

  listSign: function () {
    this.getMealList();
  },

  onShow() {
    this.setDateToToday()
  },
  setDateToToday() {
    // 把日期选择器的时间设置为当天
    this.setData({
      date: moment().format('YYYY-MM-DD')
    })
  }

})